﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Chatter.aspx.cs" Inherits="WebChat.User.Chatter" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server" >

    <asp:Label runat="server" ID="LiteralError" CssClass="errorMessage" />

    <fieldset>
        <table>
            <tr>
                <td>
                    <asp:Label runat="server" AssociatedControlID="LiteralUserName" Text="Username: " />
                </td>
                <td>
                    <asp:Literal runat="server" ID="LiteralUserName" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label runat="server" ID="LabelFirstName" AssociatedControlID="LiteralFirstName" Text="First Name: " />
                </td>
                <td>
                    <asp:Literal runat="server" ID="LiteralFirstName" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label runat="server" ID="LabelLastName" AssociatedControlID="LiteralLastName" Text="Last Name: " />
                </td>
                <td>
                    <asp:Literal runat="server" ID="LiteralLastName" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label runat="server" ID="LabelLastActivityDate" AssociatedControlID="LiteralLastActivityDate" Text="Last Activity: " />
                </td>
                <td>
                    <asp:Literal runat="server" ID="LiteralLastActivityDate" />
                </td>
            </tr>
            <tr>
                <td>
                    Roles
                </td>
                <td>
                    <asp:Literal ID="LiteralRoles" runat="server" />
                </td>
            </tr>
        </table>
    </fieldset>
    <p>
        Chat History:
    </p>

    <asp:ScriptManager runat="server" ID="ScriptManager" />    
    <asp:UpdatePanel runat="server" ID="UpdatePanelMessages" UpdateMode="Conditional" >
        <%--<Triggers>
            <asp:AsyncPostBackTrigger ControlID="TimerMessages" />
        </Triggers>--%>
        <ContentTemplate>        
            <asp:UpdatePanel runat="server" ID="UpdatePanelTimer" UpdateMode="Conditional" >
                <ContentTemplate>
                    <asp:Timer runat="server" ID="TimerMessages" Interval="1000" OnTick="TimerMessages_OnTick" />
                </ContentTemplate>
            </asp:UpdatePanel>
            
            <asp:Repeater runat="server" ID="RepeaterMessages" >
                <SeparatorTemplate>
                    ...
                </SeparatorTemplate>
                <ItemTemplate>
                <p>
                    [<asp:HyperLink runat="server" 
                            Text="delete" 
                            NavigateUrl='<%# "ConfirmDeleteChatterMessage.aspx?messageId=" + Eval("MessageId") %>'
                            Visible=' <%# EvalSenderChatterIdEqualsCurrentChatterId() %>' />]

                    [<asp:Label runat="server" 
                            Text='<%# ((DateTime)Eval("DateTimeSent")).ToShortTimeString() %>' 
                            ToolTip='<%# ((DateTime)Eval("DateTimeSent")).ToString() %>'  />]
                    <asp:Literal runat="server" 
                            Text='<%# EvalChatterUserName() %>' />

                    <asp:Label runat="server" class="message"
                            Text='<%# SafeEval("MessageContent") %>' />
                </p>
                </ItemTemplate>
            </asp:Repeater>

            <asp:Label ID="Label1" runat="server" Text="Message: " AssociatedControlID="TextBoxMessage" />
            <asp:TextBox runat="server" ID="TextBoxMessage" />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBoxMessage" >
                *
            </asp:RequiredFieldValidator>
            <asp:Button runat="server" ID="ButtonSendMessage" OnClick="ButtonSendMessage_OnClick" Text="Send" />

        </ContentTemplate>
    </asp:UpdatePanel>
    

    
</asp:Content>
